package workspaces;

import java.util.HashMap;
import java.util.Map;

public class WorkSpaceCenter {
    private static WorkSpaceCenter instance;
    public static WorkSpaceCenter getInstance() {
        if (instance == null) {
            instance = new WorkSpaceCenter();
        }
        return instance;
    }

    private Map<String, WorkSpace> workSpaceMap = new HashMap<>();

    public void registerWorkSpace(String name, WorkSpace workSpace) {
        workSpaceMap.put(name, workSpace);
    }

    public WorkSpace getWorkSpace(String name) {
        if(!workSpaceMap.containsKey(name)) {
            return null;
        }
        return workSpaceMap.get(name);
    }

    public Map<String, WorkSpace> getWorkSpaceMap() {
        return workSpaceMap;
    }
}
